class Solution:
    def checkInclusion(self, s1: str, s2: str) -> bool:
        n = len(s1)
        q = len(s2)

        if n > q:
            return False
        zeros = [0 for i in range(26)]
        s1_lst = zeros[:]
        s2_lst = zeros[:]
        for i in range(n):
            s1_lst[ord(s1[i])-97] +=1
            s2_lst[ord(s2[i])-97] += 1
        if s1_lst == s2_lst :
            return True
        
        for i in range(n,q):
            s2_lst[ord(s2[i])-97] += 1
            s2_lst[ord(s2[i-n])-97] -= 1
            if s2_lst == s1_lst:
                return True
        return False


